package model

import "time"

type StoRewardVO struct {
	Uid          int
	Addr         string
	Staking      float64
	AdReward     float64
	Withdraw     float64
	Balance      float64
	StakeTime    *time.Time
	StakeLife    int
	InvCode      int
	InvCount     int
	Ctime        time.Time
	Utime        time.Time
	WithDrawList []*StoWithdraw
}

// 把用户的推荐信息、推广收益、提现列表等封装到一起
func NewStoRewardVo(cat *Catcoin, sto *StoReward, withdrawList []*StoWithdraw) *StoRewardVO {
	if nil == sto {
		return &StoRewardVO{
			cat.Uid,
			cat.Addr,
			0,
			0,
			0,
			0,
			nil,
			0,
			cat.InvCode,
			cat.InvCount,
			cat.Ctime,
			cat.Utime,
			withdrawList,
		}
	} else {
		return &StoRewardVO{
			cat.Uid,
			sto.Addr,
			sto.Staking,
			sto.AdReward,
			sto.Withdraw,
			sto.Balance,
			&sto.StakeTime,
			sto.StakeLife,
			cat.InvCode,
			cat.InvCount,
			cat.Ctime,
			cat.Utime,
			withdrawList,
		}
	}
}
